<?php
session_start(); //start a session
include "php/smallauth/smallauth_include.php"; //include smallauth
check_login(true); //check login (redirect if not loggedin->true)

//////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////This is a simple add user script//////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
    $user = $_POST['user'];
    $pass = $_POST['pass'];
    if ($user && $pass){
        
        require("php/auth/vars.php"); //require MySQL conection settings
        mysql_connect($auth_mysql_server, $auth_mysql_user, $auth_mysql_pass); //connect to MySQL
        mysql_select_db($auth_mysql_db); // select MySQL database
        
        $passe = md5($pass.$auth_salt);
        
        $query = "INSERT INTO `users` VALUES ('', '$user', '$passe')"; 
		mysql_query($query);
		echo (mysql_error());
        
        mysql_close();
		echo "user account '$user' created with password: '$pass'";
    }
?>
<!DOCTYPE>
<html>
<head>
<title>You are logged in !</title>
</head>
<body>
<h1>Welcome <?php echo $_SESSION['user'];/*Display user name*/ echo ' -- '; logoutlink(true);/*echo logout link in html*/?></h1>
<h2>This is a simple add user script</h2>
<form method="post" action='signup.php'>
<table>
<tr>
<td width='300'>
<span>user</span>
</td>
<td width='300'>
<input type="text" name="user"/>
</td>
</tr>
<tr>
<td width='300'>
<span>pass</span>
</td>
<td width='300'>
<input type="text" name="pass"/>
</td>
</tr>
<tr>
<td><input type='submit' name='submit'/></td>
</tr>
</table>
</form>
<tabel>
</table>
</body> 
</html>
